<?php
/* * **************************************************************************************\
 * *   @name		EXP Templates 1.0                                               **
 * *   @package          Joomla 1.6/1.7/2.5                                              **
 * *   @author		EXP TEAM::Alexey Kurguz (Grusha)                                **
 * *   @copyright	Copyright (C) 2005 - 2011  EXP TEAM::Alexey Kurguz (Grusha)     **
 * *   @link             http://www.feellove.eu                                          **
 * *   @license		Commercial License                                              **
  \*************************************************************************************** */
// No direct access.
defined('_JEXEC') or die;

function modChrome_bootstrap($module, &$params, &$attribs) {
    $headerLevel = isset($attribs['headerLevel']) ? (int) $attribs['headerLevel'] : 3;
    if (!empty($module->content)) {
        ?>
        <div class="expdef_module">
            <ul class="nav nav-list">
                <?php if ($module->showtitle): ?> 
                    <li class="nav-header"><?php echo $module->title; ?></li>
                <?php endif; ?> 
                <li><?php echo $module->content; ?></li>
            </ul>
        </div>
        <?php
    };
}
function modChrome_bootstrap_div($module, &$params, &$attribs) {
    $headerLevel = isset($attribs['headerLevel']) ? (int) $attribs['headerLevel'] : 3;
    if (!empty($module->content)) {
        ?>
        <div class="expdef_module">
            <div class="thumbnail">
                <?php if ($module->showtitle): ?> 
                <div class="well well-small expmod_well"><?php echo $module->title; ?></div>
                <?php endif; ?> 
                <div class="exptemp_mod_content"><?php echo $module->content; ?></div>
            </div>
        </div>
        <?php
    };
}
function modChrome_bootstrap_divdef($module, &$params, &$attribs) {
    $headerLevel = isset($attribs['headerLevel']) ? (int) $attribs['headerLevel'] : 3;
    if (!empty($module->content)) {
        ?>
        <div class="expdef_module">
                <?php if ($module->showtitle): ?>
                <div class="expmod_well"><h4><?php echo $module->title; ?></h4></div>
                <?php endif; ?> 
                <div class="exptemp_mod_content"><?php echo $module->content; ?></div>
        </div>
        <?php
    };
}

function modChrome_bootstrap_table($module, &$params, &$attribs) {
    $headerLevel = isset($attribs['headerLevel']) ? (int) $attribs['headerLevel'] : 3;
    if (!empty($module->content)) {
        ?>
        <table class="table table-striped table-bordered">
        <?php if ($module->showtitle): ?>
                <tr>
                    <th><?php echo $module->title; ?></th>
                </tr>
        <?php endif; ?> 
            <tr>
                <td><?php echo $module->content; ?></td>
            </tr>
        </table>
        <?php
    };
}

function modChrome_exptabs($module, $params, $attribs) {

    static $modulecount;
    static $modules;

    if ($modulecount < 1) {
        $modulecount = count(JModuleHelper::getModules($attribs['name']));
        $modules = array();
    }

    if ($modulecount == 1) {
        $temp = new stdClass();
        $temp->content = $module->content;
        $temp->title = $module->title;
        $temp->params = $module->params;
        $temp->id = $module->id;
        $modules[] = $temp;
        echo '<ul class="nav nav-tabs">';
        foreach ($modules as $rendermodule) {
            echo '<li class="tab"><a href="#exptab_' . $rendermodule->id . '"  data-toggle="tab">' . $rendermodule->title . '</a></li>';
        }
        echo '</ul>';
        $counter = 0;
        echo '<div class="tab-content">';
        foreach ($modules as $rendermodule) {
            $counter++;

            echo '<div tabindex="-1" class="tab-pane" id="exptab_' . $rendermodule->id . '">';
            echo $rendermodule->content;
            echo '</div>';
        }
        $modulecount--;
        echo '</div>';
    } else {
        $temp = new stdClass();
        $temp->content = $module->content;
        $temp->params = $module->params;
        $temp->title = $module->title;
        $temp->id = $module->id;
        $modules[] = $temp;
        $modulecount--;
    }
}

function modChrome_expcollapse($module, $params, $attribs) {
    static $modulecount;
    static $modules;

    if ($modulecount < 1) {
        $modulecount = count(JModuleHelper::getModules($attribs['name']));
        $modules = array();
    }

    if ($modulecount == 1) {
        echo '<div id="expaccordion' . $module->id . '" class="accordion">';
        $temp = new stdClass();
        $temp->content = $module->content;
        $temp->title = $module->title;
        $temp->params = $module->params;
        $temp->id = $module->id;
        $modules[] = $temp;
        foreach ($modules as $val => $rendermodule) {
            $col_in = '';
            if ($val == 0)
                $col_in = 'in';
            echo '<div class="accordion-group">';
            echo '<div class="accordion-heading">
                <a class="accordion-toggle" href="#collapse_' . $rendermodule->id . '" data-parent="#expaccordion' . $module->id . '" data-toggle="collapse">' . $rendermodule->title . '</a>
                </div>';
            echo '<div id="collapse_' . $rendermodule->id . '" class="accordion-body collapse ' . $col_in . '">
                <div class="accordion-inner">' . $rendermodule->content . '</div>
                </div>';
            echo '</div>';
        }
        echo '</div>';
    } else {
        $temp = new stdClass();
        $temp->content = $module->content;
        $temp->params = $module->params;
        $temp->title = $module->title;
        $temp->id = $module->id;
        $modules[] = $temp;
        $modulecount--;
    }
}

function modChrome_bootstrapdef($module, &$params, &$attribs) {
    $headerLevel = isset($attribs['headerLevel']) ? (int) $attribs['headerLevel'] : 3;
    if (!empty($module->content)) {
        ?>
        <div class="<?php echo htmlspecialchars($params->get('moduleclass_sfx')); ?>">
            <ul class="breadcrumb">
                <?php if ($module->showtitle) { ?> 
                    <li class="nav-header"><?php echo $module->title; ?></li>
        <?php }; ?> 
                <li><?php echo $module->content; ?></li>
            </ul>
        </div>
        <?php
    };
}

function modChrome_bootstrap_withsfx($module, &$params, &$attribs) {
    $headerLevel = isset($attribs['headerLevel']) ? (int) $attribs['headerLevel'] : 3;
    if (!empty($module->content)) {
        ?>
        <div class="expdef_module <?php echo htmlspecialchars($params->get('moduleclass_sfx')); ?>">
            <ul class="nav nav-list">
                <?php if ($module->showtitle): ?> 
                    <li class="nav-header"><?php echo $module->title; ?></li>
        <?php endif; ?> 
                <li><?php echo $module->content; ?></li>
            </ul>
        </div>
        <?php
    };
}

/***** tested variant 
function modChrome_bootstrap_modal($module, &$params, &$attribs) {
    $headerLevel = isset($attribs['headerLevel']) ? (int) $attribs['headerLevel'] : 3;
    if (!empty($module->content)) {
        ?>
        <div id="myModal<?php echo $module->id;?>" class="modal">
            <div class="modal-header">
                <button class="close" data-dismiss="modal">×</button>
                <?php if ($module->showtitle): ?> 
                    <?php echo $module->title; ?>
                <?php endif; ?> 
            </div>
            <div class="modal-body">
                <?php echo $module->content; ?>
            </div>
            <div class="modal-footer"></div>
        </div>
        <?php
    };
}
*****/
/**** version 1.1 ****/

function modChrome_bootstrap_affix($module, &$params, &$attribs) {
    $headerLevel = isset($attribs['headerLevel']) ? (int) $attribs['headerLevel'] : 3;
    if (!empty($module->content)) {
        ?>
        <div class="expdef_module well well-small" data-spy="affix" data-offset-top="200">
            <ul class="nav nav-list">
                <?php if ($module->showtitle): ?> 
                    <li class="nav-header"><?php echo $module->title; ?></li>
                <?php endif; ?> 
                <li><?php echo $module->content; ?></li>
            </ul>
        </div>
        <?php
    };
}
